import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    port: 5173,
    host: true
  },
  preview: {
    port: 5174,
    host: true
  },
  optimizeDeps: {
    exclude: ['web-ifc-viewer', 'web-ifc']
  },
  ssr: {
    noExternal: ['element-plus']
  },
  // 确保 WASM 文件被正确处理
  assetsInclude: ['**/*.wasm'],
  publicDir: 'public'
})

